/*
 * Copyright (c) 2009, DanikX Corporation. All Rights Reserved.
 */

/*
 * Copyright (c) 2009, DanikX Corporation. All Rights Reserved.
 */

package kz.home.http;

import javax.microedition.io.Connector;
import javax.microedition.io.HttpConnection;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.Vector;

/**
 * <strong>title</strong>
 * <p> describe
 *
 * @author: Danik <br>
 * Date: 08.07.2009  <br>
 * Time: 12:05:39  <br>
 */
public class Http {
    protected int countBytes = 0;
    protected static Http instance = new Http();


    private Http() {}

    public static Http getInstance() {
        return instance;
    }

    public String requestMainData(String url) throws IOException {
        if (url == null || "".equals(url)) return "";
        countBytes = 0;

        HttpConnection http = (HttpConnection) Connector.open(url);
        http.setRequestMethod(HttpConnection.GET);

        http.setRequestProperty("User-agent", "Mozilla/2.0.0.11");
        //http.setRequestProperty("Accept-Encoding", "gzip");
        http.setRequestProperty("Accept-Charset", "utf-8");
        http.setRequestProperty("Accept-Language", "ru,en-us;");

        return getStringFromStream(new InputStreamReader(http.openInputStream(), "CP1251"), 17000 - 2300);
    }

    public String sendRequest(String url, String jsonData) throws IOException {
        if (url == null || "".equals(url)) return "";

        HttpConnection http = (HttpConnection) Connector.open(url);
        http.setRequestMethod(HttpConnection.POST);

        http.setRequestProperty("User-agent", "Mozilla/2.0.0.11");
        http.setRequestProperty("Accept-Charset", "utf-8");
        http.setRequestProperty("Accept-Language", "ru,en-us;");
        //
        OutputStream stream = http.openDataOutputStream();
        stream.write(jsonData.getBytes());
        stream.close();
        //
        countBytes += jsonData.getBytes().length;
        InputStreamReader inStream = new InputStreamReader(http.openInputStream(), "CP1251");
        
        //return getStringFromStream(inStream, Integer.parseInt(http.getHeaderField("Content-Length")));
        return getStringFromStream_(inStream);
        //return "ok:1,cnt:183,res:[{id:3946559,date:\"2009-07-30\",cin:16,mov:1832,room:0,time:1400,price1:450,price2:350,price3:250},{id:3946558,date:\"2009-07-30\",cin:16,mov:1824,room:0,time:1640,price1:550,price2:450,price3:300},{id:3946557,date:\"2009-07-30\",cin:16,mov:1832,room:0,time:1840,price1:750,price2:550,price3:350},{id:3946556,date:\"2009-07-30\",cin:16,mov:1832,room:0,time:2120,price1:750,price2:550,price3:0},{id:3946909,date:\"2009-07-30\",cin:17,mov:1830,room:1,time:1255,price1:650,price2:550,price3:0},{id:3946910,date:\"2009-07-30\",cin:17,mov:1830,room:1,time:1450,price1:750,price2:650,price3:0},{id:3946911,date:\"2009-07-30\",cin:17,mov:1830,room:1,time:1645,price1:850,price2:750,price3:0},{id:3946912,date:\"2009-07-30\",cin:17,mov:1830,room:1,time:1840,price1:1000,price2:900,price3:0},{id:3946913,date:\"2009-07-30\",cin:17,mov:1832,room:1,time:2115,price1:1000,price2:900,price3:0},{id:3946914,date:\"2009-07-30\",cin:17,mov:1830,room:1,time:2400,price1:1000,price2:900,price3:0},{id:3946916,date:\"2009-07-30\",cin:17,mov:1816,room:2,time:1350,price1:650,price2:550,price3:400},{id:3946917,date:\"2009-07-30\",cin:17,mov:1824,room:2,time:1540,price1:750,price2:650,price3:500},{id:3946918,date:\"2009-07-30\",cin:17,mov:1821,room:2,time:1745,price1:900,price2:800,price3:700},{id:3946919,date:\"2009-07-30\",cin:17,mov:1825,room:2,time:2035,price1:1000,price2:900,price3:0},{id:3946920,date:\"2009-07-30\",cin:17,mov:1829,room:2,time:2225,price1:1000,price2:900,price3:0},{id:3946921,date:\"2009-07-30\",cin:17,mov:1824,room:2,time:2420,price1:1000,price2:900,price3:0},{id:3946924,date:\"2009-07-30\",cin:17,mov:1832,room:3,time:1310,price1:650,price2:550,price3:0},{id:3946926,date:\"2009-07-30\",cin:17,mov:1832,room:3,time:1550,price1:850,price2:750,price3:0},{id:3946927,date:\"2009-07-30\",cin:17,mov:1832,room:3,time:1830,price1:1000,price2:900,price3:0},{id:3946928,date:\"2009-07-30\",cin:17,mov:1832,room:3,time:2115,price1:1000,price2:900,price3:0},{id:3946930,date:\"2009-07-30\",cin:17,mov:1832,room:3,time:2400,price1:1000,price2:900,price3:0},{id:3946931,date:\"2009-07-30\",cin:17,mov:1831,room:4,time:1215,price1:650,price2:550,price3:400},{id:3946932,date:\"2009-07-30\",cin:17,mov:1833,room:4,time:1410,price1:750,price2:650,price3:500},{id:3946933,date:\"2009-07-30\",cin:17,mov:1826,room:4,time:1555,price1:850,price2:750,price3:600},{id:3946934,date:\"2009-07-30\",cin:17,mov:1833,room:4,time:1800,price1:1000,price2:900,price3:750},{id:3946935,date:\"2009-07-30\",cin:17,mov:1831,room:4,time:1950,price1:1000,price2:900,price3:0},{id:3946936,date:\"2009-07-30\",cin:17,mov:1826,room:4,time:2150,price1:1000,price2:900,price3:0},{id:3947242,date:\"2009-07-30\",cin:17,mov:1831,room:4,time:2355,price1:1000,price2:900,price3:0},{id:3946944,date:\"2009-07-30\",cin:24,mov:1821,room:6,time:1305,price1:550,price2:450,price3:450},{id:3946945,date:\"2009-07-30\",cin:24,mov:1821,room:6,time:1610,price1:650,price2:500,price3:500},{id:3946946,date:\"2009-07-30\",cin:24,mov:1821,room:6,time:1915,price1:700,price2:600,price3:0},{id:3946947,date:\"2009-07-30\",cin:24,mov:1821,room:6,time:2220,price1:800,price2:800,price3:0},{id:3946939,date:\"2009-07-30\",cin:24,mov:1833,room:7,time:1245,price1:550,price2:450,price3:450},{id:3946940,date:\"2009-07-30\",cin:24,mov:1833,room:7,time:1500,price1:650,price2:500,price3:500},{id:3946941,date:\"2009-07-30\",cin:24,mov:1833,room:7,time:1700,price1:650,price2:500,price3:500},{id:3946942,date:\"2009-07-30\",cin:24,mov:1833,room:7,time:1900,price1:700,price2:600,price3:0},{id:3946943,date:\"2009-07-30\",cin:24,mov:1833,room:7,time:2100,price1:800,price2:800,price3:0},{id:3947271,date:\"2009-07-30\",cin:24,mov:1833,room:7,time:2300,price1:700,price2:700,price3:0},{id:3946949,date:\"2009-07-30\",cin:24,mov:1811,room:8,time:1225,price1:550,price2:450,price3:450},{id:3946950,date:\"2009-07-30\",cin:24,mov:1829,room:8,time:1520,price1:650,price2:500,price3:500},{id:3946951,date:\"2009-07-30\",cin:24,mov:1811,room:8,time:1730,price1:650,price2:500,price3:500},{id:3946952,date:\"2009-07-30\",cin:24,mov:1829,room:8,time:2025,price1:800,price2:800,price3:0},{id:3946953,date:\"2009-07-30\",cin:24,mov:1829,room:8,time:2235,price1:800,price2:800,price3:0},{id:3946954,date:\"2009-07-30\",cin:24,mov:1816,room:9,time:1235,price1:550,price2:450,price3:450},{id:3946955,date:\"2009-07-30\",cin:24,mov:1825,room:9,time:1440,price1:550,price2:450,price3:450},{id:3946956,date:\"2009-07-30\",cin:24,mov:1816,room:9,time:1640,price1:650,price2:500,price3:500},{id:3946957,date:\"2009-07-30\",cin:24,mov:1825,room:9,time:1845,price1:700,price2:600,price3:0},{id:3947272,date:\"2009-07-30\",cin:24,mov:1825,room:9,time:2045,price1:800,price2:800,price3:0},{id:3947273,date:\"2009-07-30\",cin:24,mov:1816,room:9,time:2245,price1:800,price2:800,price3:0},{id:3947003,date:\"2009-07-30\",cin:52,mov:1816,room:6,time:1310,price1:700,price2:700,price3:700},{id:3947002,date:\"2009-07-30\",cin:52,mov:1821,room:6,time:1520,price1:800,price2:800,price3:0},{id:3947001,date:\"2009-07-30\",cin:52,mov:1816,room:6,time:1820,price1:1200,price2:1200,price3:1200},{id:3947000,date:\"2009-07-30\",cin:52,mov:1821,room:6,time:2030,price1:1200,price2:1200,price3:0},{id:3946999,date:\"2009-07-30\",cin:52,mov:1821,room:6,time:2230,price1:1100,price2:1100,price3:0},{id:3946997,date:\"2009-07-30\",cin:52,mov:1806,room:7,time:1330,price1:600,price2:500,price3:0},{id:3946996,date:\"2009-07-30\",cin:52,mov:1822,room:7,time:1600,price1:700,price2:600,price3:0},{id:3946995,date:\"2009-07-30\",cin:52,mov:1814,room:7,time:1845,price1:900,price2:900,price3:0},{id:3946994,date:\"2009-07-30\",cin:52,mov:1806,room:7,time:2100,price1:1000,price2:1000,price3:0},{id:3946993,date:\"2009-07-30\",cin:52,mov:1822,room:7,time:2315,price1:1000,price2:1000,price3:0},{id:3946992,date:\"2009-07-30\",cin:52,mov:1830,room:8,time:1320,price1:600,price2:500,price3:500},{id:3946991,date:\"2009-07-30\",cin:52,mov:1830,room:8,time:1535,price1:700,price2:600,price3:600},{id:3946990,date:\"2009-07-30\",cin:52,mov:1819,room:8,time:1800,price1:900,price2:900,price3:900},{id:3946989,date:\"2009-07-30\",cin:52,mov:1830,room:8,time:2015,price1:1000,price2:1000,price3:1000},{id:3946988,date:\"2009-07-30\",cin:52,mov:1830,room:8,time:2230,price1:1000,price2:1000,price3:1000},{id:3946986,date:\"2009-07-30\",cin:52,mov:1826,room:9,time:1235,price1:600,price2:500,price3:500},{id:3946985,date:\"2009-07-30\",cin:52,mov:1816,room:9,time:1450,price1:600,price2:500,price3:500},{id:3946984,date:\"2009-07-30\",cin:52,mov:1826,room:9,time:1700,price1:700,price2:600,price3:600},{id:3946983,date:\"2009-07-30\",cin:52,mov:1826,room:9,time:1915,price1:900,price2:900,price3:900},{id:3946982,date:\"2009-07-30\",cin:52,mov:1826,room:9,time:2140,price1:1000,price2:1000,price3:1000},{id:3946980,date:\"2009-07-30\",cin:52,mov:1829,room:10,time:1250,price1:600,price2:500,price3:500},{id:3946979,date:\"2009-07-30\",cin:52,mov:1820,room:10,time:1500,price1:700,price2:600,price3:600},{id:3946978,date:\"2009-07-30\",cin:52,mov:1829,room:10,time:1715,price1:700,price2:600,price3:600},{id:3946977,date:\"2009-07-30\",cin:52,mov:1829,room:10,time:1930,price1:900,price2:900,price3:900},{id:3946976,date:\"2009-07-30\",cin:52,mov:1829,room:10,time:2200,price1:1000,price2:1000,price3:1000},{id:3946974,date:\"2009-07-30\",cin:52,mov:1824,room:11,time:1400,price1:600,price2:500,price3:500},{id:3946973,date:\"2009-07-30\",cin:52,mov:1825,room:11,time:1615,price1:700,price2:600,price3:600},{id:3946972,date:\"2009-07-30\",cin:52,mov:1824,room:11,time:1835,price1:900,price2:900,price3:900},{id:3946971,date:\"2009-07-30\",cin:52,mov:1825,room:11,time:2045,price1:1000,price2:1000,price3:1000},{id:3946970,date:\"2009-07-30\",cin:52,mov:1824,room:11,time:2245,price1:1000,price2:1000,price3:1000},{id:3946968,date:\"2009-07-30\",cin:52,mov:1833,room:12,time:1340,price1:600,price2:500,price3:500},{id:3946967,date:\"2009-07-30\",cin:52,mov:1833,room:12,time:1545,price1:700,price2:600,price3:600},{id:3946966,date:\"2009-07-30\",cin:52,mov:1833,room:12,time:1745,price1:700,price2:600,price3:600},{id:3946965,date:\"2009-07-30\",cin:52,mov:1833,room:12,time:1945,price1:900,price2:900,price3:900},{id:3947299,date:\"2009-07-30\",cin:52,mov:1833,room:12,time:2215,price1:1000,price2:1000,price3:1000},{id:3946964,date:\"2009-07-30\",cin:52,mov:1833,room:13,time:1340,price1:3000,price2:0,price3:0},{id:3946963,date:\"2009-07-30\",cin:52,mov:1833,room:13,time:1545,price1:3000,price2:0,price3:0},{id:3946962,date:\"2009-07-30\",cin:52,mov:1833,room:13,time:1745,price1:3000,price2:0,price3:0},{id:3946961,date:\"2009-07-30\",cin:52,mov:1833,room:13,time:1945,price1:3000,price2:0,price3:0},{id:3947300,date:\"2009-07-30\",cin:52,mov:1833,room:13,time:2215,price1:3000,price2:0,price3:0},{id:3946857,date:\"2009-07-30\",cin:10,mov:1829,room:0,time:1240,price1:500,price2:300,price3:250},{id:3946858,date:\"2009-07-30\",cin:10,mov:1821,room:0,time:1430,price1:600,price2:400,price3:250},{id:3946859,date:\"2009-07-30\",cin:10,mov:1829,room:0,time:1710,price1:900,price2:600,price3:250},{id:3946860,date:\"2009-07-30\",cin:10,mov:1825,room:0,time:1900,price1:900,price2:600,price3:250},{id:3946861,date:\"2009-07-30\",cin:10,mov:1829,room:0,time:2200,price1:900,price2:600,price3:0},{id:3947180,date:\"2009-07-30\",cin:10,mov:1821,room:0,time:2230,price1:900,price2:600,price3:0},{id:3946829,date:\"2009-07-30\",cin:18,mov:1831,room:1,time:1300,price1:500,price2:300,price3:250},{id:3946830,date:\"2009-07-30\",cin:18,mov:1830,room:1,time:1500,price1:600,price2:400,price3:0},{id:3946831,date:\"2009-07-30\",cin:18,mov:1824,room:1,time:1650,price1:600,price2:400,price3:300},{id:3946832,date:\"2009-07-30\",cin:18,mov:1830,room:1,time:1850,price1:900,price2:600,price3:0},{id:3946833,date:\"2009-07-30\",cin:18,mov:1831,room:1,time:2050,price1:900,price2:600,price3:300},{id:3946834,date:\"2009-07-30\",cin:18,mov:1830,room:1,time:2250,price1:900,price2:600,price3:0},{id:3946836,date:\"2009-07-30\",cin:18,mov:1816,room:3,time:1440,price1:700,price2:500,price3:400},{id:3946837,date:\"2009-07-30\",cin:18,mov:1832,room:3,time:1640,price1:700,price2:500,price3:0},{id:3946838,date:\"2009-07-30\",cin:18,mov:1832,room:3,time:1920,price1:1000,price2:700,price3:0},{id:3946839,date:\"2009-07-30\",cin:18,mov:1832,room:3,time:2200,price1:1000,price2:700,price3:0},{id:3946863,date:\"2009-07-30\",cin:11,mov:1825,room:0,time:1240,price1:400,price2:300,price3:200},{id:3946864,date:\"2009-07-30\",cin:11,mov:1822,room:0,time:1420,price1:600,price2:400,price3:250},{id:3946865,date:\"2009-07-30\",cin:11,mov:1816,room:0,time:1620,price1:600,price2:400,price3:250},{id:3946866,date:\"2009-07-30\",cin:11,mov:1822,room:0,time:1810,price1:800,price2:500,price3:250},{id:3946867,date:\"2009-07-30\",cin:11,mov:1825,room:0,time:2010,price1:800,price2:500,price3:0},{id:3947188,date:\"2009-07-30\",cin:11,mov:1822,room:0,time:2200,price1:800,price2:500,price3:0},{id:3947007,date:\"2009-07-30\",cin:62,mov:1829,room:6,time:1240,price1:500,price2:400,price3:300},{id:3947008,date:\"2009-07-30\",cin:62,mov:1824,room:6,time:1440,price1:600,price2:500,price3:400},{id:3947009,date:\"2009-07-30\",cin:62,mov:1826,room:6,time:1650,price1:700,price2:600,price3:500},{id:3947010,date:\"2009-07-30\",cin:62,mov:1829,room:6,time:1900,price1:900,price2:800,price3:700},{id:3947011,date:\"2009-07-30\",cin:62,mov:1824,room:6,time:2100,price1:900,price2:800,price3:700},{id:3947012,date:\"2009-07-30\",cin:62,mov:1829,room:6,time:2320,price1:900,price2:800,price3:0},{id:3947013,date:\"2009-07-30\",cin:62,mov:1832,room:7,time:1400,price1:600,price2:500,price3:0},{id:3947014,date:\"2009-07-30\",cin:62,mov:1832,room:7,time:1705,price1:800,price2:700,price3:0},{id:3947015,date:\"2009-07-30\",cin:62,mov:1832,room:7,time:1950,price1:900,price2:800,price3:0},{id:3947016,date:\"2009-07-30\",cin:62,mov:1832,room:7,time:2240,price1:900,price2:800,price3:0},{id:3947017,date:\"2009-07-30\",cin:62,mov:1831,room:8,time:1220,price1:500,price2:400,price3:300},{id:3947018,date:\"2009-07-30\",cin:62,mov:1831,room:8,time:1420,price1:600,price2:500,price3:500},{id:3947019,date:\"2009-07-30\",cin:62,mov:1831,room:8,time:1620,price1:700,price2:600,price3:500},{id:3947020,date:\"2009-07-30\",cin:62,mov:1831,room:8,time:1820,price1:800,price2:700,price3:500},{id:3947021,date:\"2009-07-30\",cin:62,mov:1831,room:8,time:2020,price1:900,price2:800,price3:700},{id:3947022,date:\"2009-07-30\",cin:62,mov:1831,room:8,time:2220,price1:900,price2:800,price3:0},{id:3947024,date:\"2009-07-30\",cin:62,mov:1830,room:9,time:1250,price1:500,price2:400,price3:0},{id:3947025,date:\"2009-07-30\",cin:62,mov:1816,room:9,time:1450,price1:600,price2:500,price3:400},{id:3947026,date:\"2009-07-30\",cin:62,mov:1830,room:9,time:1640,price1:700,price2:700,price3:0},{id:3947027,date:\"2009-07-30\",cin:62,mov:1830,room:9,time:1840,price1:800,price2:700,price3:0},{id:3947028,date:\"2009-07-30\",cin:62,mov:1830,room:9,time:2040,price1:900,price2:800,price3:0},{id:3947029,date:\"2009-07-30\",cin:62,mov:1830,room:9,time:2310,price1:900,price2:800,price3:0},{id:3947031,date:\"2009-07-30\",cin:62,mov:1833,room:10,time:1350,price1:600,price2:500,price3:400},{id:3947032,date:\"2009-07-30\",cin:62,mov:1833,room:10,time:1540,price1:700,price2:600,price3:500},{id:3947033,date:\"2009-07-30\",cin:62,mov:1825,room:10,time:1730,price1:800,price2:700,price3:500},{id:3947034,date:\"2009-07-30\",cin:62,mov:1833,room:10,time:1920,price1:900,price2:800,price3:700},{id:3947035,date:\"2009-07-30\",cin:62,mov:1833,room:10,time:2110,price1:900,price2:800,price3:0},{id:3947128,date:\"2009-07-30\",cin:62,mov:1825,room:10,time:2300,price1:900,price2:800,price3:0},{id:3946878,date:\"2009-07-30\",cin:12,mov:1825,room:1,time:1350,price1:500,price2:300,price3:200},{id:3946877,date:\"2009-07-30\",cin:12,mov:1806,room:1,time:1540,price1:600,price2:300,price3:200},{id:3946876,date:\"2009-07-30\",cin:12,mov:1825,room:1,time:1750,price1:600,price2:500,price3:200},{id:3946875,date:\"2009-07-30\",cin:12,mov:1806,room:1,time:1940,price1:800,price2:500,price3:0},{id:3946874,date:\"2009-07-30\",cin:12,mov:1825,room:1,time:2150,price1:800,price2:500,price3:0},{id:3946872,date:\"2009-07-30\",cin:12,mov:1816,room:3,time:1310,price1:500,price2:300,price3:200},{id:3946871,date:\"2009-07-30\",cin:12,mov:1826,room:3,time:1500,price1:600,price2:300,price3:200},{id:3946870,date:\"2009-07-30\",cin:12,mov:1816,room:3,time:1710,price1:600,price2:500,price3:200},{id:3946869,date:\"2009-07-30\",cin:12,mov:1826,room:3,time:1900,price1:800,price2:500,price3:0},{id:3946868,date:\"2009-07-30\",cin:12,mov:1826,room:3,time:2100,price1:800,price2:500,price3:0},{id:3946576,date:\"2009-07-30\",cin:76,mov:1827,room:0,time:1600,price1:500,price2:300,price3:200},{id:3946575,date:\"2009-07-30\",cin:76,mov:1816,room:0,time:1800,price1:500,price2:300,price3:200},{id:3946574,date:\"2009-07-30\",cin:76,mov:1827,room:0,time:1940,price1:500,price2:300,price3:200},{id:3946573,date:\"2009-07-30\",cin:76,mov:1816,room:0,time:2140,price1:500,price2:300,price3:200},{id:3947238,date:\"2009-07-30\",cin:13,mov:1821,room:0,time:1340,price1:650,price2:350,price3:350},{id:3947239,date:\"2009-07-30\",cin:13,mov:1826,room:0,time:1630,price1:750,price2:350,price3:350},{id:3947240,date:\"2009-07-30\",cin:13,mov:1821,room:0,time:1830,price1:850,price2:350,price3:0},{id:3947241,date:\"2009-07-30\",cin:13,mov:1824,room:0,time:2120,price1:850,price2:350,price3:0},{id:3946505,date:\"2009-07-30\",cin:21,mov:1816,room:1,time:1310,price1:500,price2:400,price3:300},{id:3946506,date:\"2009-07-30\",cin:21,mov:1820,room:1,time:1510,price1:600,price2:500,price3:350},{id:3946507,date:\"2009-07-30\",cin:21,mov:1816,room:1,time:1710,price1:700,price2:500,price3:350},{id:3946508,date:\"2009-07-30\",cin:21,mov:1819,room:1,time:1910,price1:800,price2:700,price3:350},{id:3946509,date:\"2009-07-30\",cin:21,mov:1816,room:1,time:2110,price1:800,price2:700,price3:350},{id:3946511,date:\"2009-07-30\",cin:21,mov:1821,room:3,time:1420,price1:600,price2:500,price3:350},{id:3946512,date:\"2009-07-30\",cin:21,mov:1821,room:3,time:1730,price1:700,price2:600,price3:350},{id:3946513,date:\"2009-07-30\",cin:21,mov:1821,room:3,time:2040,price1:800,price2:700,price3:350},{id:3946568,date:\"2009-07-30\",cin:14,mov:1833,room:0,time:1220,price1:500,price2:400,price3:250},{id:3946569,date:\"2009-07-30\",cin:14,mov:1833,room:0,time:1400,price1:600,price2:400,price3:300},{id:3946570,date:\"2009-07-30\",cin:14,mov:1832,room:0,time:1540,price1:650,price2:400,price3:300},{id:3946571,date:\"2009-07-30\",cin:14,mov:1833,room:0,time:1820,price1:850,price2:550,price3:300},{id:3946572,date:\"2009-07-30\",cin:14,mov:1832,room:0,time:2000,price1:1000,price2:550,price3:0},{id:3947223,date:\"2009-07-30\",cin:14,mov:1832,room:0,time:2210,price1:1000,price2:550,price3:0},{id:3946852,date:\"2009-07-30\",cin:19,mov:1821,room:0,time:1400,price1:700,price2:500,price3:300},{id:3946853,date:\"2009-07-30\",cin:19,mov:1832,room:0,time:1640,price1:700,price2:500,price3:0},{id:3946854,date:\"2009-07-30\",cin:19,mov:1832,room:0,time:1920,price1:1000,price2:700,price3:0},{id:3946855,date:\"2009-07-30\",cin:19,mov:1832,room:0,time:2200,price1:1000,price2:700,price3:0},{id:3946889,date:\"2009-07-30\",cin:15,mov:1832,room:1,time:1350,price1:700,price2:300,price3:250},{id:3946888,date:\"2009-07-30\",cin:15,mov:1832,room:1,time:1620,price1:900,price2:700,price3:300},{id:3946887,date:\"2009-07-30\",cin:15,mov:1832,room:1,time:1850,price1:1000,price2:700,price3:300},{id:3946886,date:\"2009-07-30\",cin:15,mov:1832,room:1,time:2130,price1:1000,price2:700,price3:0},{id:3946883,date:\"2009-07-30\",cin:15,mov:1821,room:2,time:1330,price1:700,price2:500,price3:300},{id:3946882,date:\"2009-07-30\",cin:15,mov:1831,room:2,time:1630,price1:900,price2:700,price3:300},{id:3946881,date:\"2009-07-30\",cin:15,mov:1821,room:2,time:1820,price1:900,price2:700,price3:300},{id:3946880,date:\"2009-07-30\",cin:15,mov:1831,room:2,time:2120,price1:1000,price2:700,price3:0}],sort:\"date\"";
    }

    protected String getStringFromStream(InputStreamReader stream, int length) throws IOException {
        countBytes = 0;
        char[] some = new char[length];
        int start = 0;

        stream.read(some, start, some.length);
        stream.close();

        countBytes = some.length;
        return new String(some);
    }

    protected String getStringFromStream_(InputStreamReader stream) throws IOException {
        Vector vector = new Vector();

        int ch;
        while ((ch = stream.read()) != -1) {
            vector.addElement(new Integer(ch));
        }
        stream.close();

        byte[] seed = new byte[vector.size()];
        for (int i = 0; i < vector.size(); i++) {
            seed[i] = ((Integer) vector.elementAt(i)).byteValue();
        }
        return new String(seed);
    }

    public int getCountBytes() {
        return countBytes;
    }
}